﻿#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int removeElement(int* nums, int numsSize, int val)
{
	int src = 0;
	int dst = 0;
	for (src = 0; src < numsSize; src++)
	{
		if (nums[src] != val)
		{
			nums[dst] = nums[src];
			dst++;
		}
		else
			;
	}
	return dst;
}
int main()
{
	int nums[] = { 0,1,2,2,3,0,4,2 };
	int val = 2;
	int numsSize = sizeof(nums) / sizeof(nums[0]);
	int sz = removeElement(nums, numsSize, val);
	for (int i = 0; i < sz; i++)
	{
		printf("%d ", nums[i]);
	}
	return 0;
}